package datastructures;

import java.awt.Color;
import java.io.Serializable;
import java.util.UUID;

/**
 * @author ricky
 *
 */
public class Datum implements Comparable<Datum>, Serializable{
  private static final long serialVersionUID = 1L;

  /**
   * The value of this datum, used for sorting.
   */
  public final int value;
  
  /**
   * The unique identifier associated with this Datum.  This allows for verifying the stability of a sort algorithm.
   */
  public final UUID id; 
  
  /**
   * The status of this object
   */
  public Status status;
  
  public Color getColor() {
    return this.status.color;
  }
  
  /**
   * @param value
   */
  public Datum(int value) {
    if (value < 0) value = 0;
    this.value = value;
    this.id = UUID.randomUUID();
    this.status = Status.DEFAULT;
  }

  /*
   * (non-Javadoc)
   * @see java.lang.Comparable#compareTo(java.lang.Object)
   */
  @Override
  public int compareTo(Datum o) {
    return this.value - o.value;
  }
}
